//
//  BKCompareViewController.m
//  baokaodaxue
//
//  Created by dangyangyang on 15/6/3.
//  Copyright (c) 2015年 宏图教育. All rights reserved.
//

#import "BKCompareViewController.h"
#import "BKCompareTableViewCell.h"


static NSString *compare = @"compare";

@interface BKCompareViewController ()<UITableViewDelegate,UITableViewDataSource>
@property (weak, nonatomic) IBOutlet UITableView *tableView;

@end

@implementation BKCompareViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view from its nib.
    
    [_tableView registerNib:[UINib nibWithNibName:NSStringFromClass([BKCompareTableViewCell class]) bundle:nil] forCellReuseIdentifier:compare];
    _tableView.separatorColor = [UIColor clearColor];
    _tableView.layer.borderColor = [[UIColor lightGrayColor] CGColor];
    _tableView.layer.borderWidth = 1;
    _tableView.layer.cornerRadius = 3;
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/
- (IBAction)p_dismiss:(id)sender {
    [self dismissViewControllerAnimated:YES completion:nil];
}


- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{

    if ([_dataArray count]!=2) {
        return 0;
    }
    return 21;
}


- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{

    BKCompareTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:compare];
    switch (indexPath.row) {
        case 0:
            cell.cal1.text = @"";
            cell.cal2.text = _dataArray[0][@"name"];
            cell.cal3.text = _dataArray[1][@"name"];
            
            break;
        case 1:
            cell.cal1.text = @"类型";
            cell.cal2.text = _dataArray[0][@"type"];
            cell.cal3.text = _dataArray[1][@"type"];
            
            break;
        case 2:{
            cell.cal1.text = @"所在地";
            cell.cal2.text = _dataArray[0][@"location"];
            cell.cal3.text = _dataArray[1][@"location"];
        }
            break;
        case 3:
            cell.cal1.text = @"是否211";
            cell.cal2.text = [_dataArray[0][@"is211"] isEqualToString:@"0"]?@"否":@"是";
            cell.cal3.text = [_dataArray[1][@"is211"] isEqualToString:@"0"]?@"否":@"是";

           break;
        case 4:
            cell.cal1.text = @"是否985";
            cell.cal2.text = [_dataArray[0][@"is985"] isEqualToString:@"0"]?@"否":@"是";
            cell.cal3.text = [_dataArray[1][@"is985"] isEqualToString:@"0"]?@"否":@"是";
            break;
        case 5:
            cell.cal1.text = @"隶属";
            cell.cal2.text = _dataArray[0][@"lishu"];
            cell.cal3.text = _dataArray[1][@"lishu"];
            break;
            
        case 6:
            
            cell.cal1.text = @"设计研究生院";
            cell.cal2.text = [_dataArray[0][@"yjs"] isEqualToString:@"0"]?@"否":@"是";
            cell.cal3.text = [_dataArray[1][@"yjs"] isEqualToString:@"0"]?@"否":@"是";
            break;
        case 7:
            cell.cal1.text = @"独立学院";
            cell.cal2.text = [_dataArray[0][@"dl"] isEqualToString:@"0"]?@"否":@"是";
            cell.cal3.text = [_dataArray[1][@"dl"] isEqualToString:@"0"]?@"否":@"是";
            break;
            
        case 8 :
            cell.cal1.text = @"办学层次";
            cell.cal2.text = [_dataArray[0][@"level"] isEqualToString:@"1"]?@"本科":@"专科";
            cell.cal3.text = [_dataArray[1][@"level"] isEqualToString:@"1"]?@"本科":@"专科";
            break;
        case 9 :
            cell.cal1.text = @"办学";
            cell.cal2.text = [_dataArray[0][@"banxue"] isEqualToString:@"1"]?@"公办":([_dataArray[0][@"banxue"] isEqualToString:@"2"]?@"民办":@"中外合办");
            cell.cal3.text = [_dataArray[1][@"banxue"] isEqualToString:@"1"]?@"公办":([_dataArray[1][@"banxue"] isEqualToString:@"2"]?@"民办":@"中外合办");
            break;
        case 10 :
            cell.cal1.text = @"办学层次";
            cell.cal2.text = [_dataArray[0][@"level"] isEqualToString:@"1"]?@"本科":@"专科";
            cell.cal3.text = [_dataArray[1][@"level"] isEqualToString:@"1"]?@"本科":@"专科";
            break;
        case 11 :
            cell.cal1.text = @"硕士点";
            cell.cal2.text = _dataArray[0][@"ssd"] ;
             cell.cal3.text = _dataArray[1][@"ssd"] ;
            break;
        case 12 :
            cell.cal1.text = @"博士点";
            cell.cal2.text = _dataArray[0][@"bsd"];
            cell.cal3.text = _dataArray[1][@"bsd"];
            break;
        case 13 :
            cell.cal1.text = @"博士后流动站";
            cell.cal2.text = _dataArray[0][@"bsh"];
            cell.cal3.text = _dataArray[1][@"bsh"];
            break;
        case 14 :
            cell.cal1.text = @"两院院士";
            cell.cal2.text = _dataArray[0][@"lyys"];
            cell.cal3.text = _dataArray[1][@"lyys"];

            break;
        case 15 :
            cell.cal1.text = @"藏书";
            cell.cal2.text = _dataArray[0][@"cs"];
            cell.cal3.text = _dataArray[1][@"cs"];

            break;
        case 16 :
            cell.cal1.text = @"占地面积";
            cell.cal2.text = _dataArray[0][@"zdmj"];
            cell.cal3.text = _dataArray[1][@"zdmj"];

            break;
        case 17 :
            cell.cal1.text = @"电话";
            cell.cal2.text = _dataArray[0][@"landline"];
            cell.cal3.text = _dataArray[1][@"landline"];
            break;
        case 18 :
            cell.cal1.text = @"男女比例";
            cell.cal2.text = _dataArray[0][@"fm"];
            cell.cal3.text = _dataArray[1][@"fm"];
            break;
            
        case 19 :
            cell.cal1.text = @"在校生信息";
            cell.cal2.text = _dataArray[0][@"stuinfo"];
            cell.cal3.text = _dataArray[1][@"stuinfo"];

            break;
            
        default:
            
        break;
    }
    
    
    if (indexPath.row%2==0) {
        cell.backgroundColor = [UIColor colorWithRed:0.910 green:0.965 blue:0.980 alpha:1.000];
    }else{
    
        cell.backgroundColor = [UIColor clearColor];
    }
    return cell;
}

- (UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section{


    return [UIView new];
}
- (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section{

    return 10;
}
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{

    return 46;
    
}

@end








